#ifndef  _RB_Port_H
#define  _RB_Port_H


#include <Arduino.h>
#include <stdint.h>
#include <stdlib.h>


#define NC       0
#define A0      14
#define A1      15
#define A2      16
#define A3      17
#define A4      18
#define A5      19
#define PWM0    3
#define PWM1    11


#define RGB_LED_Pin    2
#define Buzzer_Pin     4
#define USER_KEY_Pin   8

#define MOTOR_PWM0     5 
#define MOTOR_PWM1     6
#define MOTOR_PWM2     9 
#define MOTOR_PWM3     10

#define   Other_Device                   0xff
#define   None_Device                    0x00
#define   Encode_Motor_Divice            0x01
#define   Ultrasonic_Distance_Sensor     0x02
#define   LED_Matraix_Blue               0x03
#define   Line_Follower_Sensor           0x04
#define   Servo_Device                   0x05
#define   Temp_And_Humi_Sensor           0x06
#define   Light_Sensor                   0x07
#define   Sound_Sensor                   0x08
#define   DC_Motor_Device                0x09






typedef struct 
{
   uint8_t clk;
   uint8_t dat;
} RB_Port_Sig;

extern RB_Port_Sig  RBPort[5];

class RB_Port 
{
   public :
          /*  1
           * 
           */
         RB_Port(void);
         /*  2
          * 
          */
         RB_Port(uint8_t port);
         /* 3
          * 
          */
         uint8_t  GetPort(void);    
         /*
          * 
          */
         uint8_t  GetClk(void);
         /*   
          *    
          */
         uint8_t GetDat(void);
         /*
          * 
          */
          bool DReadClk(void);
          /*
           * 
           */
          bool DReadDat(void);
          /*
           * 
           */
          void DWriteClk(bool value);
          /*
           * 
           */
          void DWriteDat(bool value );
          /*
           * 
           */
          int16_t AReadClk(void);
          /*
           * 
           */
          int16_t AReadDat(void);
          /*
           * 
           */
          void ResetPort(uint8_t port);
 protected:
         uint8_t  _clk;
         uint8_t  _dat;
         uint8_t  _port;
            
} ; 

#endif 
